<template>
  <div>
    <el-option v-for="item in dictList" :label="item.label" :value="item.value" :key="item.value"></el-option>
  </div>
</template>

<script>
import { getDic } from '@/api/utils/index'
export default {
  name: 'distOption',
  props: {
    dictName: {
      type: String
    }
  },
  data() {
    return {
      dictList: [],
    }
  },
  mounted() {
    if(this.dictName) this.getDicList()
  },
  methods: {
    getDicList() {
      getDic(this.dictName).then(res => {
        const { data } = res
        for (let i in data) {
          this.dictList.push({
            value: parseInt(i),
            label: data[i]
          }); 
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
